package com.yanqu.road.server.cmd.activity.dragonboatrace;

import com.yanqu.road.pb.dragonboatrace.DragonBoatRaceProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.activity.dragonboatrace.DragonBoatRaceModule;
import com.yanqu.road.server.manger.activity.dragonboatrace.DragonBoatRaceMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.ClientProtocol;
import com.yanqu.road.server.protocol.GameProtocol;

@Cmd(code = GameProtocol.S_DRAGONBOATRACE_END, desc = "赛龙舟结束比赛")
public class DragonBoatRaceEndCmd extends AbstractCommand {


    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        DragonBoatRaceProto.DragonBoatRaceEndRespMsg.Builder builder = DragonBoatRaceMgr.endGame(player);
        player.sendPacket(ClientProtocol.U_DRAGONBOATRACE_END, builder);
        DragonBoatRaceModule dragonBoatRaceModule = DragonBoatRaceMgr.getDragonBoatRaceModule(player);
        dragonBoatRaceModule.syncUserData();
    }

    @Override
    public void sendData(GamePlayer player) {
    }
}
